/******************************
ICFLM

Sets up project directories and, when it comes time to produce replication materials,
will run all required project programs in the proper order.
******************************/

//Master directory path
global dir "C:\Users\garre\Documents\Work\Papers\Mig_Fam\icflm_replication_archive" //the only line that needs to be edited

//set up project folders
global data "$dir/Data" //raw data
global scratch "$dir/Temp" //place to stash intermediate files and other refuse
global dofiles "$dir/Dofiles" //dofiles
global output "$dir/Output" //output
global model "$dir/Model" //model code, etc
global temp "$scratch"
exit
**************PART 1: DESIGN-BASED DOFILES**************

// ACS: All using publically available data
do "$dofiles/01_reduced_form/00_cc_price_clean.do" // collapses child care price database to the state level (used for ACS) and county level (used for PSID)
do "$dofiles/01_reduced_form/01_acs_motication_data_clean.do" // cleans ACS sample used for motivating empirical facts
do "dofiles/01_reduced_form/02_acs_regressions.do" //runs ACS empirical motivation analyses; creates Table 1 Table 3 Figure 1 Table A.I Table A.II Table A.III Table A.V

// PSID empirical motivation: All use restricted access data available through application to ICPSR. The following files cannot be run outside of the PSID enclave.
* See READ ME file in  "dofiles/01_reduced_form/RestrictedAccess_DoFiles/README_restrictedaccess.docs" for information on how to access the data and run the relevant cleaning/analysis files.



**************PART 2: Pre-Model Estimation Dofiles**************
// All using publically available data
//PSID Cleaning and preparation
do "$dofiles/02_model/01_pre_est/00_psid_big_clean" //read in PSID data and perform preliminary cleaning
do "$dofiles/02_model/01_pre_est/01_psid_merge" //merge PSID files together
do "$dofiles/02_model/01_pre_est/02_psid_estimation_sample" //clean PSID data further and construct estimation sample. Lines 404 and 406 create spousal wage FE values in Table VIII.
do "$dofiles/02_model/01_pre_est/03_psid_summ_stats" //produces summary statistics for PSID sample. Constructs Table A.VIII and A.IX.
do "$dofiles/02_model/01_pre_est/04_marr_probs" //constructs marriage transition probabilities from PSID data

//Division characteristics cleaning and preparation
do "$dofiles/02_model/01_pre_est/05_acs_wagereg_prep" //cleans ACS sample in preparation for genearting location spousal wage effects
do "$dofiles/02_model/01_pre_est/06_acs_location_fes" //geneates location wage effects for spouses in the model
do "$dofiles/02_model/01_pre_est/07_amenities" //prepares location amenity measures
do "$dofiles/02_model/01_pre_est/08_create_ccc_pt1" //prepares 1 of two CCC measures
do "$dofiles/02_model/01_pre_est/09_create_ccc_pt2" //prepares second CCC measure. no longer used, but kept in here so that other code runs.
do "$dofiles/02_model/01_pre_est/10_assemble_div_chars" //assembles division characteristics for model usage

//Additional miscellaneous ACS analyses
do "$dofiles/02_model/01_pre_est/ACS_additional/00_amenity_assembly" //alternate assembly of amenity data for use in subsequent dofile
do "$dofiles/02_model/01_pre_est/ACS_additional/01_acs_motivation_prep" //constructs an ACS sample used for out-of-sample fit statistics

**************PART 3: Post-Model Estimation Dofiles -- Can only be run after running icflm_master.jl **************
do "$dofiles/02_model/02_post_est/01_prep_estimate_table" //reports model estimates. Produces Table 9 and Table A.X
do "$dofiles/02_model/02_post_est/02_descriptives" //produces Table 10. In line 20, use "sample = 1" for Panel A and "sample = 2" for Panel B
do "$dofiles/02_model/02_post_est/03_mig_fit" //Produces Table 11 and statistics of repeate migration discussed in Section 6.2
do "$dofiles/02_model/02_post_est/04_lifecycle_profiles" //Produces Figures 4 and 5A
do "$dofiles/02_model/02_post_est/05_lifecycle_profiles_race" //Produces Figures AIIIb and 5b
do "$dofiles/02_model/02_post_est/06_fert_elasticities" //Reports fertility elasticities that are discussed in footnote 25 of paper, Section 6.2
do "$dofiles/02_model/02_post_est/07_ccc_usage" //Reports measures of informal care usage, discussed in final paragraph of Section 5.2.
do "$dofiles/02_model/02_post_est/08_repeate_mig_stats" //Reports share of individuals who move multliple times by age 45 in simulated data, discussed in Section 5.2
do "$dofiles/02_model/02_post_est/09_mig_selection" //Produces Table AXI: estimates of selection in terms of who starts the model outside the grandparent location
do "$dofiles/02_model/02_post_est/10_movingcost_automated" //Produces monetary cost of average move in simulated data, discussed in Section 5.1
do "$dofiles/02_model/02_post_est/11_cfact_analysis_gpars" //Produces Table 12
do "$dofiles/02_model/02_post_est/12_cfact_analysis_policies" //Produces Table 13 and 14


//end of dofile
